Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR addresses multiple SpotBugs FE_FLOATING_POINT_EQUALITY warnings by replacing direct floating-point equality comparisons with standard Float.compare() or Double.compare() calls, or isZero() checks where appropriate.

Changes include:

  • GeneralPath.java: Replaced == 0.0 and != 0.0 checks with isZero() logic (ensuring isZero is accessible or replacing with !isZero).
  • RoundRectBorder.java: Replaced strokeThickness == 0 with Float.compare(strokeThickness, 0f) == 0.
  • CSSBorder.java: Replaced equality checks in equals() with Float.compare.
  • XYSeries.java, XYValueSeries.java: Replaced direct double comparisons in remove() methods with Double.compare.
  • Location.java: Updated equalsLatLng to use Double.compare.
  • Command.java: Updated equals to compare materialIconSize using Float.compare.
  • Stroke.java: Updated equals to use Float.compare for float fields.
  • LayeredLayout.java: Updated percent inset logic to safely compare with Float.NEGATIVE/POSITIVE_INFINITY.
  • Border.java: Updated equals to use Float.compare for thickness.
  • generate-quality-report.py: Added FE_FLOATING_POINT_EQUALITY to the list of forbidden rules to prevent regression.

All relevant unit tests have been run and passed.


PR created automatically by Jules for task 13845971805834301377 started by @shai-almog

Fixed floating point equality checks by replacing `==` and `!=` with `Float.compare` and `Double.compare` or `isZero` checks across multiple files.
Updated `generate-quality-report.py` to enforce this rule in CI.
Fixed files:
- CodenameOne/src/com/codename1/ui/geom/GeneralPath.java
- CodenameOne/src/com/codename1/ui/plaf/CSSBorder.java
- CodenameOne/src/com/codename1/ui/plaf/RoundRectBorder.java
- CodenameOne/src/com/codename1/charts/models/XYSeries.java
- CodenameOne/src/com/codename1/charts/models/XYValueSeries.java
- CodenameOne/src/com/codename1/location/Location.java
- CodenameOne/src/com/codename1/ui/Command.java
- CodenameOne/src/com/codename1/ui/Stroke.java
- CodenameOne/src/com/codename1/ui/layouts/LayeredLayout.java
- CodenameOne/src/com/codename1/ui/plaf/Border.java
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@shai-almog
Copy link
Collaborator

shai-almog commented Dec 26, 2025

Compared 30 screenshots: 30 matched.

Native Android coverage

  • 📊 Line coverage: 24.73% (2649/10711 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.36% (12304/50505), branch 15.25% (712/4668), complexity 17.42% (738/4237), method 32.84% (597/1818), class 34.98% (106/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.PushNotificationService – 0.00% (0/59 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 24.73% (2649/10711 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.36% (12304/50505), branch 15.25% (712/4668), complexity 17.42% (738/4237), method 32.84% (597/1818), class 34.98% (106/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.PushNotificationService – 0.00% (0/59 lines covered)

@shai-almog
Copy link
Collaborator

shai-almog commented Dec 26, 2025

iOS screenshot updates

Compared 30 screenshots: 23 matched, 6 updated, 1 missing reference.

  • BrowserComponent — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    BrowserComponent
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as BrowserComponent.png in workflow artifacts.

  • graphics-draw-arc — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-arc
    Preview info: JPEG preview quality 20; JPEG preview quality 20; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-arc.png in workflow artifacts.

  • graphics-draw-gradient — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-gradient
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-gradient.png in workflow artifacts.

  • graphics-draw-round-rect — missing reference. Reference screenshot missing at /Users/runner/work/CodenameOne/CodenameOne/scripts/ios/screenshots/graphics-draw-round-rect.png.

    graphics-draw-round-rect
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-round-rect.png in workflow artifacts.

  • graphics-draw-string — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 422x918.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string-decorated
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-string-decorated.png in workflow artifacts.

  • kotlin — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 335 seconds
  • Compilation Time: 103 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 35360 ms
Extract Extensions 25 ms
Google Services Setup 3 ms
Scan Classes 558 ms
Extract Libs 1173 ms
Inject Build Hints 54 ms
Generate Unit Tests 2 ms
Generate Stubs 1284 ms
Compile Stubs 2484 ms
Generate Icons 1376 ms
Prepare ParparVM 233 ms
ParparVM Execution 199499 ms
Post-VM Setup 188 ms
CocoaPods 6333 ms
Finalize 23 ms
Total Time 248596 msMaven Overhead : 87000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot (Run) 47000 ms
App Install 25000 ms
App Launch 9000 ms
Test Execution 160000 ms

Fixed floating point equality checks by replacing `==` and `!=` with `Float.compare` and `Double.compare` or `isZero` checks across multiple files.
Updated `generate-quality-report.py` to enforce this rule in CI.
Fixed files:
- CodenameOne/src/com/codename1/ui/geom/GeneralPath.java
- CodenameOne/src/com/codename1/ui/plaf/CSSBorder.java
- CodenameOne/src/com/codename1/ui/plaf/RoundRectBorder.java
- CodenameOne/src/com/codename1/charts/models/XYSeries.java
- CodenameOne/src/com/codename1/charts/models/XYValueSeries.java
- CodenameOne/src/com/codename1/location/Location.java
- CodenameOne/src/com/codename1/ui/Command.java
- CodenameOne/src/com/codename1/ui/Stroke.java
- CodenameOne/src/com/codename1/ui/layouts/LayeredLayout.java
- CodenameOne/src/com/codename1/ui/plaf/Border.java
@github-actions
Copy link

github-actions bot commented Dec 26, 2025

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

Refactored to use `com.codename1.util.MathUtil.compare` for floating point comparisons to avoid using `Float.compare` and `Double.compare` which are not available in CLDC 1.1.
Added `compare` methods to `com.codename1.util.MathUtil`.
Fixed `FE_FLOATING_POINT_EQUALITY` warnings in:
- CodenameOne/src/com/codename1/ui/geom/GeneralPath.java
- CodenameOne/src/com/codename1/ui/plaf/CSSBorder.java
- CodenameOne/src/com/codename1/ui/plaf/RoundRectBorder.java
- CodenameOne/src/com/codename1/charts/models/XYSeries.java
- CodenameOne/src/com/codename1/charts/models/XYValueSeries.java
- CodenameOne/src/com/codename1/location/Location.java
- CodenameOne/src/com/codename1/ui/Command.java
- CodenameOne/src/com/codename1/ui/Stroke.java
- CodenameOne/src/com/codename1/ui/layouts/LayeredLayout.java
- CodenameOne/src/com/codename1/ui/plaf/Border.java
Updated `generate-quality-report.py` to enforce this rule in CI.
@shai-almog shai-almog marked this pull request as ready for review December 26, 2025 10:01
@shai-almog shai-almog merged commit 2dba7f4 into master Dec 26, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants